package cn.zxh.csdn_maven.work.flow.login;

import java.io.IOException;
import java.util.Map;

import cn.zxh.csdn_maven.work.flow.login.chains.*;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;


public class WorkFlowde {

	private static WorkFlowde workFlowde=new WorkFlowde();
	private IFlowController startFlow;
	private WorkFlowde(){
		/**加入工作流*/
		startFlow=new HiddenFlow();
		IFlowController login = startFlow.setNextFlow(new LoginCookieFlow());
		IFlowController js = login.setNextFlow(new JsCookiesFlow());
//		IFlowController cross = js.setNextFlow(new CrossCookieFlow());
		js.setNextFlow(new DealCookieFlow());
	}
	
	public static WorkFlowde getInstance()
	{
		return workFlowde;
	}

	public Map<String, Object> startExec(HttpClient client,Map<String, Object> params) throws ClientProtocolException, IOException
	{
		return this.startFlow.run(client,params);
	}
}
